package com.yict.csms.company.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.yict.csms.resourceplan.entity.RtgcFlContractor;
import com.yict.csms.resourceplan.entity.RtgcFlOrder;
import com.yict.csms.system.entity.User;

/**
 * 公司表Entity
 * 
 * @author Patrick.Deng
 * 
 */
@Entity
@Table(name = "CSMS_COMPANY")
public class Company {

	@Id
	@Column(name = "COMPANYID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "csms_company_seq")
	@SequenceGenerator(name = "csms_company_seq", sequenceName = "SEQ_CSMS_COMPANY", allocationSize = 1, initialValue = 1)
	private Long companyId;

	@Column(name = "COMPANYCODE")
	private String companyCode;

	@Column(name = "COMPANYNAME")
	private String companyName;

	@Column(name = "COMPANYSNAME")
	private String companySName;

	@Column(name = "COMPANYTYPE")
	private String companyType;

	@Column(name = "LEGALPERSON")
	private String legalPerson;

	@Column(name = "ADDRESS")
	private String address;

	@Column(name = "ENDBUSSDATE")
	private Date endBussDate;

	@Column(name = "REMARKS")
	private String remarks;

	@Column(name = "LICENSE")
	private String license;

	@Column(name = "WEBSITE")
	private String website;

	@Column(name = "TEL")
	private String tel;

	@Column(name = "FAX")
	private String fax;

	@Column(name = "PAYEECNAME")
	private String payeeCName;

	@Column(name = "PAYEEENAME")
	private String payeeEName;

	@Column(name = "PAYBANK")
	private String payBank;

	@Column(name = "PAYBANKNUM")
	private String payBankNum;

	@Column(name = "PAYCONCACT")
	private String payConcact;

	@Column(name = "PAYEMAIL")
	private String payEmail;
	
	@Column(name = "DELETED")
	private boolean deleted;
	
	@Column(name = "DELETE_DATE")
	private Date deletedDate;

	@Column(name = "CREATEDATE")
	private Date createDate;

	@Column(name = "UPDATEDATE")
	private Date updateDate;

	@ManyToOne
	@JoinColumn(name = "CREATEPERSON")
	private User createPerson;

	@ManyToOne
	@JoinColumn(name = "UPDATEPERSON")
	private User updatePerson;

	@OneToMany(mappedBy="company")
	@JoinColumn(name = "COMPANYID")
	@OrderBy("contractId ASC")
	public Set<Contract> contractSet;
	
	@OneToMany(mappedBy="company", fetch=FetchType.LAZY)
	@JoinColumn(name = "COMPANYID")
	public Set<RtgcFlContractor> contractorSet;
	
	@OneToMany(mappedBy="company")
	@JoinColumn(name = "COMPANYID")
	public Set<RtgcFlOrder> orderSet;
	
	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getCompanySName() {
		return companySName;
	}

	public void setCompanySName(String companySName) {
		this.companySName = companySName;
	}

	public String getCompanyType() {
		return companyType;
	}

	public void setCompanyType(String companyType) {
		this.companyType = companyType;
	}

	public String getLegalPerson() {
		return legalPerson;
	}

	public void setLegalPerson(String legalPerson) {
		this.legalPerson = legalPerson;
	}

	public Date getEndBussDate() {
		return endBussDate;
	}

	public void setEndBussDate(Date endBussDate) {
		this.endBussDate = endBussDate;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getLicense() {
		return license;
	}

	public void setLicense(String license) {
		this.license = license;
	}

	public String getWebsite() {
		return website;
	}

	public void setWebsite(String website) {
		this.website = website;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getPayeeCName() {
		return payeeCName;
	}

	public void setPayeeCName(String payeeCName) {
		this.payeeCName = payeeCName;
	}

	public String getPayeeEName() {
		return payeeEName;
	}

	public void setPayeeEName(String payeeEName) {
		this.payeeEName = payeeEName;
	}

	public String getPayBank() {
		return payBank;
	}

	public void setPayBank(String payBank) {
		this.payBank = payBank;
	}

	public String getPayBankNum() {
		return payBankNum;
	}

	public void setPayBankNum(String payBankNum) {
		this.payBankNum = payBankNum;
	}

	public String getPayConcact() {
		return payConcact;
	}

	public void setPayConcact(String payConcact) {
		this.payConcact = payConcact;
	}

	public String getPayEmail() {
		return payEmail;
	}

	public void setPayEmail(String payEmail) {
		this.payEmail = payEmail;
	}

	public User getCreatePerson() {
		return createPerson;
	}

	public void setCreatePerson(User createPerson) {
		this.createPerson = createPerson;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public User getUpdatePerson() {
		return updatePerson;
	}

	public void setUpdatePerson(User updatePerson) {
		this.updatePerson = updatePerson;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Set<Contract> getContractSet() {
		return contractSet;
	}

	public void setContractSet(Set<Contract> contractSet) {
		this.contractSet = contractSet;
	}

	public Set<RtgcFlContractor> getContractorSet() {
		return contractorSet;
	}

	public void setContractorSet(Set<RtgcFlContractor> contractorSet) {
		this.contractorSet = contractorSet;
	}

	public Set<RtgcFlOrder> getOrderSet() {
		return orderSet;
	}

	public void setOrderSet(Set<RtgcFlOrder> orderSet) {
		this.orderSet = orderSet;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public Date getDeletedDate() {
		return deletedDate;
	}

	public void setDeletedDate(Date deletedDate) {
		this.deletedDate = deletedDate;
	}
}
